<template>
	<view>
		
	</view>
</template>

<script setup lang="ts">
	let arr = [1,2,3,4]
	let newArr = []
	// forEach方法
	arr.forEach(item=>{
		arr.push(item*2)
	})
	// console.log(newArr);
	// map方法
	// newArr = arr.map(item=>item*2)
	// console.log(newArr);
	// let arrs = [{name:"华为",price:6999},{name:"苹果",price:9888},{name:"小米",price:4999}]
	// let arrs2 = arrs.map(item=>({...item,price:item.price+"元",number:888}))
	let arrs = [{key:0,content:'篮球'},{key:1,content:"足球"},{key:2,content:"排球"}]
	const arrs2 = arrs.map(({key,content})=>{
		return{
			value:key,
			text:content
		}
	})
	console.log(arrs2);
		let arrs3 = [{key:0,content:'篮球'},{key:1,content:"足球"},{key:2,content:"排球"}]
		const arrs4 = []
	arrs3.forEach(item=>{
		 arrs4.push({
			value:item.key,
			text:item.content
		})
	})
 // console.log(arrs4);
</script>

<style scoped lang="scss">
	       
</style>
